home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Include / d3dx9shader.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-09-28  |  40.7 KB  |  1,073 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  Copyright (c) Microsoft Corporation.  All rights reserved.
  4. //
  5. //  File:       d3dx9shader.h
  6. //  Content:    D3DX Shader APIs
  7. //
  8. //////////////////////////////////////////////////////////////////////////////
  9.  
  10. #include "d3dx9.h"
  11.  
  12. #ifndef __D3DX9SHADER_H__
  13. #define __D3DX9SHADER_H__
  14.  
  15.  
  16. //---------------------------------------------------------------------------
  17. // D3DXTX_VERSION:
  18. // --------------
  19. // Version token used to create a procedural texture filler in effects
  20. // Used by D3DXFill[]TX functions
  21. //---------------------------------------------------------------------------
  22. #define D3DXTX_VERSION(_Major,_Minor) (('T' << 24) | ('X' << 16) | ((_Major) << 8) | (_Minor))
  23.  
  24.  
  25.  
  26. //----------------------------------------------------------------------------
  27. // D3DXSHADER flags:
  28. // -----------------
  29. // D3DXSHADER_DEBUG
  30. //   Insert debug file/line/type/symbol information.
  31. //
  32. // D3DXSHADER_SKIPVALIDATION
  33. //   Do not validate the generated code against known capabilities and
  34. //   constraints.  This option is only recommended when compiling shaders
  35. //   you KNOW will work.  (ie. have compiled before without this option.)
  36. //   Shaders are always validated by D3D before they are set to the device.
  37. //
  38. // D3DXSHADER_SKIPOPTIMIZATION 
  39. //   Instructs the compiler to skip optimization steps during code generation.
  40. //   Unless you are trying to isolate a problem in your code using this option 
  41. //   is not recommended.
  42. //
  43. // D3DXSHADER_PACKMATRIX_ROWMAJOR
  44. //   Unless explicitly specified, matrices will be packed in row-major order
  45. //   on input and output from the shader.
  46. //
  47. // D3DXSHADER_PACKMATRIX_COLUMNMAJOR
  48. //   Unless explicitly specified, matrices will be packed in column-major 
  49. //   order on input and output from the shader.  This is generally more 
  50. //   efficient, since it allows vector-matrix multiplication to be performed
  51. //   using a series of dot-products.
  52. //
  53. // D3DXSHADER_PARTIALPRECISION
  54. //   Force all computations in resulting shader to occur at partial precision.
  55. //   This may result in faster evaluation of shaders on some hardware.
  56. //
  57. // D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT
  58. //   Force compiler to compile against the next highest available software
  59. //   target for vertex shaders.  This flag also turns optimizations off, 
  60. //   and debugging on.  
  61. //
  62. // D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT
  63. //   Force compiler to compile against the next highest available software
  64. //   target for pixel shaders.  This flag also turns optimizations off, 
  65. //   and debugging on.
  66. //
  67. // D3DXSHADER_NO_PRESHADER
  68. //   Disables Preshaders. Using this flag will cause the compiler to not 
  69. //   pull out static expression for evaluation on the host cpu
  70. //
  71. // D3DXSHADER_AVOID_FLOW_CONTROL
  72. //   Hint compiler to avoid flow-control constructs where possible.
  73. //
  74. // D3DXSHADER_PREFER_FLOW_CONTROL
  75. //   Hint compiler to prefer flow-control constructs where possible.
  76. //
  77. //----------------------------------------------------------------------------
  78.  
  79. #define D3DXSHADER_DEBUG                    (1 << 0)
  80. #define D3DXSHADER_SKIPVALIDATION           (1 << 1)
  81. #define D3DXSHADER_SKIPOPTIMIZATION         (1 << 2)
  82. #define D3DXSHADER_PACKMATRIX_ROWMAJOR      (1 << 3)
  83. #define D3DXSHADER_PACKMATRIX_COLUMNMAJOR   (1 << 4)
  84. #define D3DXSHADER_PARTIALPRECISION         (1 << 5)
  85. #define D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT  (1 << 6)
  86. #define D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT  (1 << 7)
  87. #define D3DXSHADER_NO_PRESHADER             (1 << 8)
  88. #define D3DXSHADER_AVOID_FLOW_CONTROL       (1 << 9)
  89. #define D3DXSHADER_PREFER_FLOW_CONTROL      (1 << 10)
  90.  
  91.  
  92.  
  93. //----------------------------------------------------------------------------
  94. // D3DXHANDLE:
  95. // -----------
  96. // Handle values used to efficiently reference shader and effect parameters.
  97. // Strings can be used as handles.  However, handles are not always strings.
  98. //----------------------------------------------------------------------------
  99.  
  100. typedef LPCSTR D3DXHANDLE;
  101. typedef D3DXHANDLE *LPD3DXHANDLE;
  102.  
  103.  
  104. //----------------------------------------------------------------------------
  105. // D3DXMACRO:
  106. // ----------
  107. // Preprocessor macro definition.  The application pass in a NULL-terminated
  108. // array of this structure to various D3DX APIs.  This enables the application
  109. // to #define tokens at runtime, before the file is parsed.
  110. //----------------------------------------------------------------------------
  111.  
  112. typedef struct _D3DXMACRO
  113. {
  114.     LPCSTR Name;
  115.     LPCSTR Definition;
  116.  
  117. } D3DXMACRO, *LPD3DXMACRO;
  118.  
  119.  
  120. //----------------------------------------------------------------------------
  121. // D3DXSEMANTIC:
  122. //----------------------------------------------------------------------------
  123.  
  124. typedef struct _D3DXSEMANTIC
  125. {
  126.     UINT Usage;
  127.     UINT UsageIndex;
  128.  
  129. } D3DXSEMANTIC, *LPD3DXSEMANTIC;
  130.  
  131.  
  132.  
  133. //----------------------------------------------------------------------------
  134. // D3DXFRAGMENT_DESC:
  135. //----------------------------------------------------------------------------
  136.  
  137. typedef struct _D3DXFRAGMENT_DESC
  138. {
  139.     LPCSTR Name;
  140.     DWORD Target;
  141.  
  142. } D3DXFRAGMENT_DESC, *LPD3DXFRAGMENT_DESC;
  143.  
  144.  
  145. //----------------------------------------------------------------------------
  146. // D3DXREGISTER_SET:
  147. //----------------------------------------------------------------------------
  148.  
  149. typedef enum _D3DXREGISTER_SET
  150. {
  151.     D3DXRS_BOOL,
  152.     D3DXRS_INT4,
  153.     D3DXRS_FLOAT4,
  154.     D3DXRS_SAMPLER,
  155.  
  156.     // force 32-bit size enum
  157.     D3DXRS_FORCE_DWORD = 0x7fffffff
  158.  
  159. } D3DXREGISTER_SET, *LPD3DXREGISTER_SET;
  160.  
  161.  
  162. //----------------------------------------------------------------------------
  163. // D3DXPARAMETER_CLASS:
  164. //----------------------------------------------------------------------------
  165.  
  166. typedef enum _D3DXPARAMETER_CLASS
  167. {
  168.     D3DXPC_SCALAR,
  169.     D3DXPC_VECTOR,
  170.     D3DXPC_MATRIX_ROWS,
  171.     D3DXPC_MATRIX_COLUMNS,
  172.     D3DXPC_OBJECT,
  173.     D3DXPC_STRUCT,
  174.  
  175.     // force 32-bit size enum
  176.     D3DXPC_FORCE_DWORD = 0x7fffffff
  177.  
  178. } D3DXPARAMETER_CLASS, *LPD3DXPARAMETER_CLASS;
  179.  
  180.  
  181. //----------------------------------------------------------------------------
  182. // D3DXPARAMETER_TYPE:
  183. //----------------------------------------------------------------------------
  184.  
  185. typedef enum _D3DXPARAMETER_TYPE
  186. {
  187.     D3DXPT_VOID,
  188.     D3DXPT_BOOL,
  189.     D3DXPT_INT,
  190.     D3DXPT_FLOAT,
  191.     D3DXPT_STRING,
  192.     D3DXPT_TEXTURE,
  193.     D3DXPT_TEXTURE1D,
  194.     D3DXPT_TEXTURE2D,
  195.     D3DXPT_TEXTURE3D,
  196.     D3DXPT_TEXTURECUBE,
  197.     D3DXPT_SAMPLER,
  198.     D3DXPT_SAMPLER1D,
  199.     D3DXPT_SAMPLER2D,
  200.     D3DXPT_SAMPLER3D,
  201.     D3DXPT_SAMPLERCUBE,
  202.     D3DXPT_PIXELSHADER,
  203.     D3DXPT_VERTEXSHADER,
  204.     D3DXPT_PIXELFRAGMENT,
  205.     D3DXPT_VERTEXFRAGMENT,
  206.  
  207.     // force 32-bit size enum
  208.     D3DXPT_FORCE_DWORD = 0x7fffffff
  209.  
  210. } D3DXPARAMETER_TYPE, *LPD3DXPARAMETER_TYPE;
  211.  
  212.  
  213. //----------------------------------------------------------------------------
  214. // D3DXCONSTANTTABLE_DESC:
  215. //----------------------------------------------------------------------------
  216.  
  217. typedef struct _D3DXCONSTANTTABLE_DESC
  218. {
  219.     LPCSTR Creator;                     // Creator string
  220.     DWORD Version;                      // Shader version
  221.     UINT Constants;                     // Number of constants
  222.  
  223. } D3DXCONSTANTTABLE_DESC, *LPD3DXCONSTANTTABLE_DESC;
  224.  
  225.  
  226. //----------------------------------------------------------------------------
  227. // D3DXCONSTANT_DESC:
  228. //----------------------------------------------------------------------------
  229.  
  230. typedef struct _D3DXCONSTANT_DESC
  231. {
  232.     LPCSTR Name;                        // Constant name
  233.  
  234.     D3DXREGISTER_SET RegisterSet;       // Register set
  235.     UINT RegisterIndex;                 // Register index
  236.     UINT RegisterCount;                 // Number of registers occupied
  237.  
  238.     D3DXPARAMETER_CLASS Class;          // Class
  239.     D3DXPARAMETER_TYPE Type;            // Component type
  240.  
  241.     UINT Rows;                          // Number of rows
  242.     UINT Columns;                       // Number of columns
  243.     UINT Elements;                      // Number of array elements
  244.     UINT StructMembers;                 // Number of structure member sub-parameters
  245.  
  246.     UINT Bytes;                         // Data size, in bytes
  247.     LPCVOID DefaultValue;               // Pointer to default value
  248.  
  249. } D3DXCONSTANT_DESC, *LPD3DXCONSTANT_DESC;
  250.  
  251.  
  252.  
  253. //----------------------------------------------------------------------------
  254. // ID3DXConstantTable:
  255. //----------------------------------------------------------------------------
  256.  
  257. typedef interface ID3DXConstantTable ID3DXConstantTable;
  258. typedef interface ID3DXConstantTable *LPD3DXCONSTANTTABLE;
  259.  
  260. // {AB3C758F-093E-4356-B762-4DB18F1B3A01}
  261. DEFINE_GUID(IID_ID3DXConstantTable, 
  262. 0xab3c758f, 0x93e, 0x4356, 0xb7, 0x62, 0x4d, 0xb1, 0x8f, 0x1b, 0x3a, 0x1);
  263.  
  264.  
  265. #undef INTERFACE
  266. #define INTERFACE ID3DXConstantTable
  267.  
  268. DECLARE_INTERFACE_(ID3DXConstantTable, IUnknown)
  269. {
  270.     // IUnknown
  271.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  272.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  273.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  274.  
  275.     // Buffer
  276.     STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE;
  277.     STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE;
  278.  
  279.     // Descs
  280.     STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE;
  281.     STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE;
  282.     STDMETHOD_(UINT, GetSamplerIndex)(THIS_ D3DXHANDLE hConstant) PURE;
  283.  
  284.     // Handle operations
  285.     STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE;
  286.     STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE;
  287.     STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE;
  288.  
  289.     // Set Constants
  290.     STDMETHOD(SetDefaults)(THIS_ LPDIRECT3DDEVICE9 pDevice) PURE;
  291.     STDMETHOD(SetValue)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE;
  292.     STDMETHOD(SetBool)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, BOOL b) PURE;
  293.     STDMETHOD(SetBoolArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE;
  294.     STDMETHOD(SetInt)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, INT n) PURE;
  295.     STDMETHOD(SetIntArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE;
  296.     STDMETHOD(SetFloat)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, FLOAT f) PURE;
  297.     STDMETHOD(SetFloatArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE;
  298.     STDMETHOD(SetVector)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE;
  299.     STDMETHOD(SetVectorArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE;
  300.     STDMETHOD(SetMatrix)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE;
  301.     STDMETHOD(SetMatrixArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  302.     STDMETHOD(SetMatrixPointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  303.     STDMETHOD(SetMatrixTranspose)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE;
  304.     STDMETHOD(SetMatrixTransposeArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  305.     STDMETHOD(SetMatrixTransposePointerArray)(THIS_ LPDIRECT3DDEVICE9 pDevice, D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  306. };
  307.  
  308.  
  309. //----------------------------------------------------------------------------
  310. // ID3DXTextureShader:
  311. //----------------------------------------------------------------------------
  312.  
  313. typedef interface ID3DXTextureShader ID3DXTextureShader;
  314. typedef interface ID3DXTextureShader *LPD3DXTEXTURESHADER;
  315.  
  316. // {3E3D67F8-AA7A-405d-A857-BA01D4758426}
  317. DEFINE_GUID(IID_ID3DXTextureShader, 
  318. 0x3e3d67f8, 0xaa7a, 0x405d, 0xa8, 0x57, 0xba, 0x1, 0xd4, 0x75, 0x84, 0x26);
  319.  
  320. #undef INTERFACE
  321. #define INTERFACE ID3DXTextureShader
  322.  
  323. DECLARE_INTERFACE_(ID3DXTextureShader, IUnknown)
  324. {
  325.     // IUnknown
  326.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  327.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  328.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  329.  
  330.     // Gets
  331.     STDMETHOD(GetFunction)(THIS_ LPD3DXBUFFER *ppFunction) PURE;
  332.     STDMETHOD(GetConstantBuffer)(THIS_ LPD3DXBUFFER *ppConstantBuffer) PURE;
  333.  
  334.     // Descs
  335.     STDMETHOD(GetDesc)(THIS_ D3DXCONSTANTTABLE_DESC *pDesc) PURE;
  336.     STDMETHOD(GetConstantDesc)(THIS_ D3DXHANDLE hConstant, D3DXCONSTANT_DESC *pConstantDesc, UINT *pCount) PURE;
  337.  
  338.     // Handle operations
  339.     STDMETHOD_(D3DXHANDLE, GetConstant)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE;
  340.     STDMETHOD_(D3DXHANDLE, GetConstantByName)(THIS_ D3DXHANDLE hConstant, LPCSTR pName) PURE;
  341.     STDMETHOD_(D3DXHANDLE, GetConstantElement)(THIS_ D3DXHANDLE hConstant, UINT Index) PURE;
  342.  
  343.     // Set Constants
  344.     STDMETHOD(SetDefaults)(THIS) PURE;
  345.     STDMETHOD(SetValue)(THIS_ D3DXHANDLE hConstant, LPCVOID pData, UINT Bytes) PURE;
  346.     STDMETHOD(SetBool)(THIS_ D3DXHANDLE hConstant, BOOL b) PURE;
  347.     STDMETHOD(SetBoolArray)(THIS_ D3DXHANDLE hConstant, CONST BOOL* pb, UINT Count) PURE;
  348.     STDMETHOD(SetInt)(THIS_ D3DXHANDLE hConstant, INT n) PURE;
  349.     STDMETHOD(SetIntArray)(THIS_ D3DXHANDLE hConstant, CONST INT* pn, UINT Count) PURE;
  350.     STDMETHOD(SetFloat)(THIS_ D3DXHANDLE hConstant, FLOAT f) PURE;
  351.     STDMETHOD(SetFloatArray)(THIS_ D3DXHANDLE hConstant, CONST FLOAT* pf, UINT Count) PURE;
  352.     STDMETHOD(SetVector)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector) PURE;
  353.     STDMETHOD(SetVectorArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXVECTOR4* pVector, UINT Count) PURE;
  354.     STDMETHOD(SetMatrix)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE;
  355.     STDMETHOD(SetMatrixArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  356.     STDMETHOD(SetMatrixPointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  357.     STDMETHOD(SetMatrixTranspose)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix) PURE;
  358.     STDMETHOD(SetMatrixTransposeArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX* pMatrix, UINT Count) PURE;
  359.     STDMETHOD(SetMatrixTransposePointerArray)(THIS_ D3DXHANDLE hConstant, CONST D3DXMATRIX** ppMatrix, UINT Count) PURE;
  360. };
  361.  
  362.  
  363.  
  364. //----------------------------------------------------------------------------
  365. // ID3DXFragmentLinker
  366. //----------------------------------------------------------------------------
  367.  
  368. typedef interface ID3DXFragmentLinker ID3DXFragmentLinker;
  369. typedef interface ID3DXFragmentLinker *LPD3DXFRAGMENTLINKER;
  370.  
  371. // {1A2C0CC2-E5B6-4ebc-9E8D-390E057811B6}
  372. DEFINE_GUID(IID_ID3DXFragmentLinker, 
  373. 0x1a2c0cc2, 0xe5b6, 0x4ebc, 0x9e, 0x8d, 0x39, 0xe, 0x5, 0x78, 0x11, 0xb6);
  374.  
  375. #undef INTERFACE
  376. #define INTERFACE ID3DXFragmentLinker
  377.  
  378. DECLARE_INTERFACE_(ID3DXFragmentLinker, IUnknown)
  379. {
  380.     // IUnknown
  381.     STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
  382.     STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  383.     STDMETHOD_(ULONG, Release)(THIS) PURE;
  384.  
  385.     // ID3DXFragmentLinker
  386.  
  387.     // fragment access and information retrieval functions
  388.     STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
  389.     STDMETHOD_(UINT, GetNumberOfFragments)(THIS) PURE;
  390.  
  391.     STDMETHOD_(D3DXHANDLE, GetFragmentHandleByIndex)(THIS_ UINT Index) PURE;
  392.     STDMETHOD_(D3DXHANDLE, GetFragmentHandleByName)(THIS_ LPCSTR Name) PURE;
  393.     STDMETHOD(GetFragmentDesc)(THIS_ D3DXHANDLE Name, LPD3DXFRAGMENT_DESC FragDesc) PURE;
  394.  
  395.     // add the fragments in the buffer to the linker
  396.     STDMETHOD(AddFragments)(THIS_ CONST DWORD *Fragments) PURE;
  397.  
  398.     // Create a buffer containing the fragments.  Suitable for saving to disk
  399.     STDMETHOD(GetAllFragments)(THIS_ LPD3DXBUFFER *ppBuffer) PURE;
  400.     STDMETHOD(GetFragment)(THIS_ D3DXHANDLE Name, LPD3DXBUFFER *ppBuffer) PURE;
  401.  
  402.     STDMETHOD(LinkShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPD3DXBUFFER *ppBuffer, LPD3DXBUFFER *ppErrorMsgs) PURE;
  403.     STDMETHOD(LinkVertexShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPDIRECT3DVERTEXSHADER9 *pVShader, LPD3DXBUFFER *ppErrorMsgs) PURE;
  404.     STDMETHOD(LinkPixelShader)(THIS_ LPCSTR pProfile, DWORD Flags, CONST D3DXHANDLE *rgFragmentHandles, UINT cFragments, LPDIRECT3DPIXELSHADER9 *pPShader, LPD3DXBUFFER *ppErrorMsgs) PURE;
  405.  
  406.     STDMETHOD(ClearCache)(THIS) PURE;
  407. };
  408.  
  409.  
  410. //----------------------------------------------------------------------------
  411. // D3DXINCLUDE_TYPE:
  412. //----------------------------------------------------------------------------
  413.  
  414. typedef enum _D3DXINCLUDE_TYPE
  415. {
  416.     D3DXINC_LOCAL,
  417.     D3DXINC_SYSTEM,
  418.  
  419.     // force 32-bit size enum
  420.     D3DXINC_FORCE_DWORD = 0x7fffffff
  421.  
  422. } D3DXINCLUDE_TYPE, *LPD3DXINCLUDE_TYPE;
  423.  
  424.  
  425. //----------------------------------------------------------------------------
  426. // ID3DXInclude:
  427. // -------------
  428. // This interface is intended to be implemented by the application, and can
  429. // be used by various D3DX APIs.  This enables application-specific handling
  430. // of #include directives in source files.
  431. //
  432. // Open()
  433. //    Opens an include file.  If successful, it should fill in ppData and
  434. //    pBytes.  The data pointer returned must remain valid until Close is
  435. //    subsequently called.
  436. // Close()
  437. //    Closes an include file.  If Open was successful, Close is guaranteed
  438. //    to be called before the API using this interface returns.
  439. //----------------------------------------------------------------------------
  440.  
  441. typedef interface ID3DXInclude ID3DXInclude;
  442. typedef interface ID3DXInclude *LPD3DXINCLUDE;
  443.  
  444. #undef INTERFACE
  445. #define INTERFACE ID3DXInclude
  446.  
  447. DECLARE_INTERFACE(ID3DXInclude)
  448. {
  449.     STDMETHOD(Open)(THIS_ D3DXINCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes) PURE;
  450.     STDMETHOD(Close)(THIS_ LPCVOID pData) PURE;
  451. };
  452.  
  453.  
  454. //////////////////////////////////////////////////////////////////////////////
  455. // APIs //////////////////////////////////////////////////////////////////////
  456. //////////////////////////////////////////////////////////////////////////////
  457.  
  458. #ifdef __cplusplus
  459. extern "C" {
  460. #endif //__cplusplus
  461.  
  462.  
  463. //----------------------------------------------------------------------------
  464. // D3DXAssembleShader:
  465. // -------------------
  466. // Assembles a shader.
  467. //
  468. // Parameters:
  469. //  pSrcFile
  470. //      Source file name
  471. //  hSrcModule
  472. //      Module handle. if NULL, current module will be used
  473. //  pSrcResource
  474. //      Resource name in module
  475. //  pSrcData
  476. //      Pointer to source code
  477. //  SrcDataLen
  478. //      Size of source code, in bytes
  479. //  pDefines
  480. //      Optional NULL-terminated array of preprocessor macro definitions.
  481. //  pInclude
  482. //      Optional interface pointer to use for handling #include directives.
  483. //      If this parameter is NULL, #includes will be honored when assembling
  484. //      from file, and will error when assembling from resource or memory.
  485. //  Flags
  486. //      See D3DXSHADER_xxx flags
  487. //  ppShader
  488. //      Returns a buffer containing the created shader.  This buffer contains
  489. //      the assembled shader code, as well as any embedded debug info.
  490. //  ppErrorMsgs
  491. //      Returns a buffer containing a listing of errors and warnings that were
  492. //      encountered during assembly.  If you are running in a debugger,
  493. //      these are the same messages you will see in your debug output.
  494. //----------------------------------------------------------------------------
  495.  
  496.  
  497. HRESULT WINAPI
  498.     D3DXAssembleShaderFromFileA(
  499.         LPCSTR                          pSrcFile,
  500.         CONST D3DXMACRO*                pDefines,
  501.         LPD3DXINCLUDE                   pInclude,
  502.         DWORD                           Flags,
  503.         LPD3DXBUFFER*                   ppShader,
  504.         LPD3DXBUFFER*                   ppErrorMsgs);
  505.  
  506. HRESULT WINAPI
  507.     D3DXAssembleShaderFromFileW(
  508.         LPCWSTR                         pSrcFile,
  509.         CONST D3DXMACRO*                pDefines,
  510.         LPD3DXINCLUDE                   pInclude,
  511.         DWORD                           Flags,
  512.         LPD3DXBUFFER*                   ppShader,
  513.         LPD3DXBUFFER*                   ppErrorMsgs);
  514.  
  515. #ifdef UNICODE
  516. #define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileW
  517. #else
  518. #define D3DXAssembleShaderFromFile D3DXAssembleShaderFromFileA
  519. #endif
  520.  
  521.  
  522. HRESULT WINAPI
  523.     D3DXAssembleShaderFromResourceA(
  524.         HMODULE                         hSrcModule,
  525.         LPCSTR                          pSrcResource,
  526.         CONST D3DXMACRO*                pDefines,
  527.         LPD3DXINCLUDE                   pInclude,
  528.         DWORD                           Flags,
  529.         LPD3DXBUFFER*                   ppShader,
  530.         LPD3DXBUFFER*                   ppErrorMsgs);
  531.  
  532. HRESULT WINAPI
  533.     D3DXAssembleShaderFromResourceW(
  534.         HMODULE                         hSrcModule,
  535.         LPCWSTR                         pSrcResource,
  536.         CONST D3DXMACRO*                pDefines,
  537.         LPD3DXINCLUDE                   pInclude,
  538.         DWORD                           Flags,
  539.         LPD3DXBUFFER*                   ppShader,
  540.         LPD3DXBUFFER*                   ppErrorMsgs);
  541.  
  542. #ifdef UNICODE
  543. #define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceW
  544. #else
  545. #define D3DXAssembleShaderFromResource D3DXAssembleShaderFromResourceA
  546. #endif
  547.  
  548.  
  549. HRESULT WINAPI
  550.     D3DXAssembleShader(
  551.         LPCSTR                          pSrcData,
  552.         UINT                            SrcDataLen,
  553.         CONST D3DXMACRO*                pDefines,
  554.         LPD3DXINCLUDE                   pInclude,
  555.         DWORD                           Flags,
  556.         LPD3DXBUFFER*                   ppShader,
  557.         LPD3DXBUFFER*                   ppErrorMsgs);
  558.  
  559.  
  560.  
  561. //----------------------------------------------------------------------------
  562. // D3DXCompileShader:
  563. // ------------------
  564. // Compiles a shader.
  565. //
  566. // Parameters:
  567. //  pSrcFile
  568. //      Source file name.
  569. //  hSrcModule
  570. //      Module handle. if NULL, current module will be used.
  571. //  pSrcResource
  572. //      Resource name in module.
  573. //  pSrcData
  574. //      Pointer to source code.
  575. //  SrcDataLen
  576. //      Size of source code, in bytes.
  577. //  pDefines
  578. //      Optional NULL-terminated array of preprocessor macro definitions.
  579. //  pInclude
  580. //      Optional interface pointer to use for handling #include directives.
  581. //      If this parameter is NULL, #includes will be honored when compiling
  582. //      from file, and will error when compiling from resource or memory.
  583. //  pFunctionName
  584. //      Name of the entrypoint function where execution should begin.
  585. //  pProfile
  586. //      Instruction set to be used when generating code.  Currently supported
  587. //      profiles are "vs_1_1", "vs_2_0", "vs_2_a", "vs_2_sw", "ps_1_1", 
  588. //      "ps_1_2", "ps_1_3", "ps_1_4", "ps_2_0", "ps_2_a", "ps_2_sw", "tx_1_0"
  589. //  Flags
  590. //      See D3DXSHADER_xxx flags.
  591. //  ppShader
  592. //      Returns a buffer containing the created shader.  This buffer contains
  593. //      the compiled shader code, as well as any embedded debug and symbol
  594. //      table info.  (See D3DXGetShaderConstantTable)
  595. //  ppErrorMsgs
  596. //      Returns a buffer containing a listing of errors and warnings that were
  597. //      encountered during the compile.  If you are running in a debugger,
  598. //      these are the same messages you will see in your debug output.
  599. //  ppConstantTable
  600. //      Returns a ID3DXConstantTable object which can be used to set
  601. //      shader constants to the device.  Alternatively, an application can
  602. //      parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within
  603. //      the shader.
  604. //----------------------------------------------------------------------------
  605.  
  606. HRESULT WINAPI
  607.     D3DXCompileShaderFromFileA(
  608.         LPCSTR                          pSrcFile,
  609.         CONST D3DXMACRO*                pDefines,
  610.         LPD3DXINCLUDE                   pInclude,
  611.         LPCSTR                          pFunctionName,
  612.         LPCSTR                          pProfile,
  613.         DWORD                           Flags,
  614.         LPD3DXBUFFER*                   ppShader,
  615.         LPD3DXBUFFER*                   ppErrorMsgs,
  616.         LPD3DXCONSTANTTABLE*            ppConstantTable);
  617.  
  618. HRESULT WINAPI
  619.     D3DXCompileShaderFromFileW(
  620.         LPCWSTR                         pSrcFile,
  621.         CONST D3DXMACRO*                pDefines,
  622.         LPD3DXINCLUDE                   pInclude,
  623.         LPCSTR                          pFunctionName,
  624.         LPCSTR                          pProfile,
  625.         DWORD                           Flags,
  626.         LPD3DXBUFFER*                   ppShader,
  627.         LPD3DXBUFFER*                   ppErrorMsgs,
  628.         LPD3DXCONSTANTTABLE*            ppConstantTable);
  629.  
  630. #ifdef UNICODE
  631. #define D3DXCompileShaderFromFile D3DXCompileShaderFromFileW
  632. #else
  633. #define D3DXCompileShaderFromFile D3DXCompileShaderFromFileA
  634. #endif
  635.  
  636.  
  637. HRESULT WINAPI
  638.     D3DXCompileShaderFromResourceA(
  639.         HMODULE                         hSrcModule,
  640.         LPCSTR                          pSrcResource,
  641.         CONST D3DXMACRO*                pDefines,
  642.         LPD3DXINCLUDE                   pInclude,
  643.         LPCSTR                          pFunctionName,
  644.         LPCSTR                          pProfile,
  645.         DWORD                           Flags,
  646.         LPD3DXBUFFER*                   ppShader,
  647.         LPD3DXBUFFER*                   ppErrorMsgs,
  648.         LPD3DXCONSTANTTABLE*            ppConstantTable);
  649.  
  650. HRESULT WINAPI
  651.     D3DXCompileShaderFromResourceW(
  652.         HMODULE                         hSrcModule,
  653.         LPCWSTR                         pSrcResource,
  654.         CONST D3DXMACRO*                pDefines,
  655.         LPD3DXINCLUDE                   pInclude,
  656.         LPCSTR                          pFunctionName,
  657.         LPCSTR                          pProfile,
  658.         DWORD                           Flags,
  659.         LPD3DXBUFFER*                   ppShader,
  660.         LPD3DXBUFFER*                   ppErrorMsgs,
  661.         LPD3DXCONSTANTTABLE*            ppConstantTable);
  662.  
  663. #ifdef UNICODE
  664. #define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceW
  665. #else
  666. #define D3DXCompileShaderFromResource D3DXCompileShaderFromResourceA
  667. #endif
  668.  
  669.  
  670. HRESULT WINAPI
  671.     D3DXCompileShader(
  672.         LPCSTR                          pSrcData,
  673.         UINT                            SrcDataLen,
  674.         CONST D3DXMACRO*                pDefines,
  675.         LPD3DXINCLUDE                   pInclude,
  676.         LPCSTR                          pFunctionName,
  677.         LPCSTR                          pProfile,
  678.         DWORD                           Flags,
  679.         LPD3DXBUFFER*                   ppShader,
  680.         LPD3DXBUFFER*                   ppErrorMsgs,
  681.         LPD3DXCONSTANTTABLE*            ppConstantTable);
  682.  
  683.  
  684. //----------------------------------------------------------------------------
  685. // D3DXDisassembleShader:
  686. // ----------------------
  687. // Takes a binary shader, and returns a buffer containing text assembly.
  688. //
  689. // Parameters:
  690. //  pShader
  691. //      Pointer to the shader byte code.
  692. //  ShaderSizeInBytes
  693. //      Size of the shader byte code in bytes.
  694. //  EnableColorCode
  695. //      Emit HTML tags for color coding the output?
  696. //  pComments
  697. //      Pointer to a comment string to include at the top of the shader.
  698. //  ppDisassembly
  699. //      Returns a buffer containing the disassembled shader.
  700. //----------------------------------------------------------------------------
  701.  
  702. HRESULT WINAPI
  703.     D3DXDisassembleShader(
  704.         CONST DWORD*                    pShader, 
  705.         BOOL                            EnableColorCode, 
  706.         LPCSTR                          pComments, 
  707.         LPD3DXBUFFER*                   ppDisassembly);
  708.  
  709.  
  710. //----------------------------------------------------------------------------
  711. // D3DXGetPixelShaderProfile/D3DXGetVertexShaderProfile:
  712. // -----------------------------------------------------
  713. // Returns the name of the HLSL profile best suited to a given device.
  714. //
  715. // Parameters:
  716. //  pDevice
  717. //      Pointer to the device in question
  718. //----------------------------------------------------------------------------
  719.  
  720. LPCSTR WINAPI
  721.     D3DXGetPixelShaderProfile(
  722.         LPDIRECT3DDEVICE9               pDevice);
  723.  
  724. LPCSTR WINAPI
  725.     D3DXGetVertexShaderProfile(
  726.         LPDIRECT3DDEVICE9               pDevice);
  727.  
  728.  
  729. //----------------------------------------------------------------------------
  730. // D3DXFindShaderComment:
  731. // ----------------------
  732. // Searches through a shader for a particular comment, denoted by a FourCC in
  733. // the first DWORD of the comment.  If the comment is not found, and no other
  734. // error has occurred, S_FALSE is returned.
  735. //
  736. // Parameters:
  737. //  pFunction
  738. //      Pointer to the function DWORD stream
  739. //  FourCC
  740. //      FourCC used to identify the desired comment block.
  741. //  ppData
  742. //      Returns a pointer to the comment data (not including comment token
  743. //      and FourCC).  Can be NULL.
  744. //  pSizeInBytes
  745. //      Returns the size of the comment data in bytes.  Can be NULL.
  746. //----------------------------------------------------------------------------
  747.  
  748. HRESULT WINAPI
  749.     D3DXFindShaderComment(
  750.         CONST DWORD*                    pFunction,
  751.         DWORD                           FourCC,
  752.         LPCVOID*                        ppData,
  753.         UINT*                           pSizeInBytes);
  754.  
  755.  
  756. //----------------------------------------------------------------------------
  757. // D3DXGetShaderSize:
  758. // ------------------
  759. // Returns the size of the shader byte-code, in bytes.
  760. //
  761. // Parameters:
  762. //  pFunction
  763. //      Pointer to the function DWORD stream
  764. //----------------------------------------------------------------------------
  765.  
  766. UINT WINAPI
  767.     D3DXGetShaderSize(
  768.         CONST DWORD*                    pFunction);
  769.  
  770.  
  771. //----------------------------------------------------------------------------
  772. // D3DXGetShaderVersion:
  773. // -----------------------
  774. // Returns the shader version of a given shader.  Returns zero if the shader 
  775. // function is NULL.
  776. //
  777. // Parameters:
  778. //  pFunction
  779. //      Pointer to the function DWORD stream
  780. //----------------------------------------------------------------------------
  781.  
  782. DWORD WINAPI
  783.     D3DXGetShaderVersion(
  784.         CONST DWORD*                    pFunction);
  785.  
  786. //----------------------------------------------------------------------------
  787. // D3DXGetShaderSemantics:
  788. // -----------------------
  789. // Gets semantics for all input elements referenced inside a given shader.
  790. //
  791. // Parameters:
  792. //  pFunction
  793. //      Pointer to the function DWORD stream
  794. //  pSemantics
  795. //      Pointer to an array of D3DXSEMANTIC structures.  The function will
  796. //      fill this array with the semantics for each input element referenced
  797. //      inside the shader.  This array is assumed to contain at least
  798. //      MAXD3DDECLLENGTH elements.
  799. //  pCount
  800. //      Returns the number of elements referenced by the shader
  801. //----------------------------------------------------------------------------
  802.  
  803. HRESULT WINAPI
  804.     D3DXGetShaderInputSemantics(
  805.         CONST DWORD*                    pFunction,
  806.         D3DXSEMANTIC*                   pSemantics,
  807.         UINT*                           pCount);
  808.  
  809. HRESULT WINAPI
  810.     D3DXGetShaderOutputSemantics(
  811.         CONST DWORD*                    pFunction,
  812.         D3DXSEMANTIC*                   pSemantics,
  813.         UINT*                           pCount);
  814.  
  815.  
  816. //----------------------------------------------------------------------------
  817. // D3DXGetShaderSamplers:
  818. // ----------------------
  819. // Gets semantics for all input elements referenced inside a given shader.
  820. //
  821. // pFunction
  822. //      Pointer to the function DWORD stream
  823. // pSamplers
  824. //      Pointer to an array of LPCSTRs.  The function will fill this array
  825. //      with pointers to the sampler names contained within pFunction, for
  826. //      each sampler referenced inside the shader.  This array is assumed to
  827. //      contain at least 16 elements.
  828. // pCount
  829. //      Returns the number of samplers referenced by the shader
  830. //----------------------------------------------------------------------------
  831.  
  832. HRESULT WINAPI
  833.     D3DXGetShaderSamplers(
  834.         CONST DWORD*                    pFunction,
  835.         LPCSTR*                         pSamplers,
  836.         UINT*                           pCount);
  837.  
  838.  
  839. //----------------------------------------------------------------------------
  840. // D3DXGetShaderConstantTable:
  841. // ---------------------------
  842. // Gets shader constant table embedded inside shader.  A constant table is
  843. // generated by D3DXAssembleShader and D3DXCompileShader, and is embedded in
  844. // the body of the shader.
  845. //
  846. // Parameters:
  847. //  pFunction
  848. //      Pointer to the function DWORD stream
  849. //  ppConstantTable
  850. //      Returns a ID3DXConstantTable object which can be used to set
  851. //      shader constants to the device.  Alternatively, an application can
  852. //      parse the D3DXSHADER_CONSTANTTABLE block embedded as a comment within
  853. //      the shader.
  854. //----------------------------------------------------------------------------
  855.  
  856. HRESULT WINAPI
  857.     D3DXGetShaderConstantTable(
  858.         CONST DWORD*                    pFunction,
  859.         LPD3DXCONSTANTTABLE*            ppConstantTable);
  860.  
  861.  
  862.  
  863. //----------------------------------------------------------------------------
  864. // D3DXCreateTextureShader:
  865. // ------------------------
  866. // Creates a texture shader object, given the compiled shader.
  867. //
  868. // Parameters
  869. //  pFunction
  870. //      Pointer to the function DWORD stream
  871. //  ppTextureShader
  872. //      Returns a ID3DXTextureShader object which can be used to procedurally 
  873. //      fill the contents of a texture using the D3DXFillTextureTX functions.
  874. //----------------------------------------------------------------------------
  875.  
  876. HRESULT WINAPI
  877.     D3DXCreateTextureShader(
  878.         CONST DWORD*                    pFunction, 
  879.         LPD3DXTEXTURESHADER*            ppTextureShader);
  880.  
  881.  
  882.  
  883. //----------------------------------------------------------------------------
  884. // D3DXGatherFragments:
  885. // -------------------
  886. // Assembles shader fragments into a buffer to be passed to a fragment linker.
  887. //   will generate shader fragments for all fragments in the file
  888. //
  889. // Parameters:
  890. //  pSrcFile
  891. //      Source file name
  892. //  hSrcModule
  893. //      Module handle. if NULL, current module will be used
  894. //  pSrcResource
  895. //      Resource name in module
  896. //  pSrcData
  897. //      Pointer to source code
  898. //  SrcDataLen
  899. //      Size of source code, in bytes
  900. //  pDefines
  901. //      Optional NULL-terminated array of preprocessor macro definitions.
  902. //  pInclude
  903. //      Optional interface pointer to use for handling #include directives.
  904. //      If this parameter is NULL, #includes will be honored when assembling
  905. //      from file, and will error when assembling from resource or memory.
  906. //  Flags
  907. //      See D3DXSHADER_xxx flags
  908. //  ppShader
  909. //      Returns a buffer containing the created shader fragments.  This buffer contains
  910. //      the assembled shader code, as well as any embedded debug info.
  911. //  ppErrorMsgs
  912. //      Returns a buffer containing a listing of errors and warnings that were
  913. //      encountered during assembly.  If you are running in a debugger,
  914. //      these are the same messages you will see in your debug output.
  915. //----------------------------------------------------------------------------
  916.  
  917.  
  918. HRESULT WINAPI
  919. D3DXGatherFragmentsFromFileA(
  920.         LPCSTR                          pSrcFile,
  921.         CONST D3DXMACRO*                pDefines,
  922.         LPD3DXINCLUDE                   pInclude,
  923.         DWORD                           Flags,
  924.         LPD3DXBUFFER*                   ppShader,
  925.         LPD3DXBUFFER*                   ppErrorMsgs);
  926.  
  927. HRESULT WINAPI
  928. D3DXGatherFragmentsFromFileW(
  929.         LPCWSTR                         pSrcFile,
  930.         CONST D3DXMACRO*                pDefines,
  931.         LPD3DXINCLUDE                   pInclude,
  932.         DWORD                           Flags,
  933.         LPD3DXBUFFER*                   ppShader,
  934.         LPD3DXBUFFER*                   ppErrorMsgs);
  935.  
  936. #ifdef UNICODE
  937. #define D3DXGatherFragmentsFromFile D3DXGatherFragmentsFromFileW
  938. #else
  939. #define D3DXGatherFragmentsFromFile D3DXGatherFragmentsFromFileA
  940. #endif
  941.  
  942.  
  943. HRESULT WINAPI
  944.     D3DXGatherFragmentsFromResourceA(
  945.         HMODULE                         hSrcModule,
  946.         LPCSTR                          pSrcResource,
  947.         CONST D3DXMACRO*                pDefines,
  948.         LPD3DXINCLUDE                   pInclude,
  949.         DWORD                           Flags,
  950.         LPD3DXBUFFER*                   ppShader,
  951.         LPD3DXBUFFER*                   ppErrorMsgs);
  952.  
  953. HRESULT WINAPI
  954.     D3DXGatherFragmentsFromResourceW(
  955.         HMODULE                         hSrcModule,
  956.         LPCWSTR                         pSrcResource,
  957.         CONST D3DXMACRO*                pDefines,
  958.         LPD3DXINCLUDE                   pInclude,
  959.         DWORD                           Flags,
  960.         LPD3DXBUFFER*                   ppShader,
  961.         LPD3DXBUFFER*                   ppErrorMsgs);
  962.  
  963. #ifdef UNICODE
  964. #define D3DXGatherFragmentsFromResource D3DXGatherFragmentsFromResourceW
  965. #else
  966. #define D3DXGatherFragmentsFromResource D3DXGatherFragmentsFromResourceA
  967. #endif
  968.  
  969.  
  970. HRESULT WINAPI
  971.     D3DXGatherFragments(
  972.         LPCSTR                          pSrcData,
  973.         UINT                            SrcDataLen,
  974.         CONST D3DXMACRO*                pDefines,
  975.         LPD3DXINCLUDE                   pInclude,
  976.         DWORD                           Flags,
  977.         LPD3DXBUFFER*                   ppShader,
  978.         LPD3DXBUFFER*                   ppErrorMsgs);
  979.  
  980.  
  981.  
  982. //----------------------------------------------------------------------------
  983. // D3DXCreateFragmentLinker:
  984. // -------------------------
  985. // Creates a fragment linker with a given cache size.  The interface returned 
  986. // can be used to link together shader fragments.  (both HLSL & ASM fragements)
  987. //
  988. // Parameters:
  989. //  pDevice
  990. //      Pointer to the device on which to create the shaders
  991. //  ShaderCacheSize
  992. //      Size of the shader cache
  993. //  ppFragmentLinker
  994. //      pointer to a memory location to put the created interface pointer
  995. //
  996. //----------------------------------------------------------------------------
  997.  
  998. HRESULT WINAPI
  999.     D3DXCreateFragmentLinker(
  1000.         LPDIRECT3DDEVICE9               pDevice,
  1001.         UINT                            ShaderCacheSize,
  1002.         LPD3DXFRAGMENTLINKER*           ppFragmentLinker);
  1003.  
  1004.  
  1005.  
  1006. #ifdef __cplusplus
  1007. }
  1008. #endif //__cplusplus
  1009.  
  1010.  
  1011. //////////////////////////////////////////////////////////////////////////////
  1012. // Shader comment block layouts //////////////////////////////////////////////
  1013. //////////////////////////////////////////////////////////////////////////////
  1014.  
  1015. //----------------------------------------------------------------------------
  1016. // D3DXSHADER_CONSTANTTABLE:
  1017. // -------------------------
  1018. // Shader constant information; included as an CTAB comment block inside
  1019. // shaders.  All offsets are BYTE offsets from start of CONSTANTTABLE struct.
  1020. // Entries in the table are sorted by Name in ascending order.
  1021. //----------------------------------------------------------------------------
  1022.  
  1023. typedef struct _D3DXSHADER_CONSTANTTABLE
  1024. {
  1025.     DWORD Size;             // sizeof(D3DXSHADER_CONSTANTTABLE)
  1026.     DWORD Creator;          // LPCSTR offset
  1027.     DWORD Version;          // shader version
  1028.     DWORD Constants;        // number of constants
  1029.     DWORD ConstantInfo;     // D3DXSHADER_CONSTANTINFO[Constants] offset
  1030.     DWORD Flags;            // flags shader was compiled with
  1031.     DWORD Target;           // LPCSTR offset 
  1032.  
  1033. } D3DXSHADER_CONSTANTTABLE, *LPD3DXSHADER_CONSTANTTABLE;
  1034.  
  1035.  
  1036. typedef struct _D3DXSHADER_CONSTANTINFO
  1037. {
  1038.     DWORD Name;             // LPCSTR offset
  1039.     WORD  RegisterSet;      // D3DXREGISTER_SET
  1040.     WORD  RegisterIndex;    // register number
  1041.     WORD  RegisterCount;    // number of registers
  1042.     WORD  Reserved;         // reserved
  1043.     DWORD TypeInfo;         // D3DXSHADER_TYPEINFO offset
  1044.     DWORD DefaultValue;     // offset of default value
  1045.  
  1046. } D3DXSHADER_CONSTANTINFO, *LPD3DXSHADER_CONSTANTINFO;
  1047.  
  1048.  
  1049. typedef struct _D3DXSHADER_TYPEINFO
  1050. {
  1051.     WORD  Class;            // D3DXPARAMETER_CLASS
  1052.     WORD  Type;             // D3DXPARAMETER_TYPE
  1053.     WORD  Rows;             // number of rows (matrices)
  1054.     WORD  Columns;          // number of columns (vectors and matrices)
  1055.     WORD  Elements;         // array dimension
  1056.     WORD  StructMembers;    // number of struct members
  1057.     DWORD StructMemberInfo; // D3DXSHADER_STRUCTMEMBERINFO[Members] offset
  1058.  
  1059. } D3DXSHADER_TYPEINFO, *LPD3DXSHADER_TYPEINFO;
  1060.  
  1061.  
  1062. typedef struct _D3DXSHADER_STRUCTMEMBERINFO
  1063. {
  1064.     DWORD Name;             // LPCSTR offset
  1065.     DWORD TypeInfo;         // D3DXSHADER_TYPEINFO offset
  1066.  
  1067. } D3DXSHADER_STRUCTMEMBERINFO, *LPD3DXSHADER_STRUCTMEMBERINFO;
  1068.  
  1069.  
  1070.  
  1071. #endif //__D3DX9SHADER_H__
  1072.  
  1073.